{% extends 'layouts/default.html' %}
{% import 'scaffolding/macros.html' as s with context %}
{% import 'macros/buttons.html' as buttons with context %}


{% block layout_head_title %} - {{ s.print_value(context[scaffolding.singular]) }}{% endblock %}

{% block layout_content %}

    <div class="media">
        {% if media %}
            <a class="pull-left" href="{{ media.link }}" target="_blank"><img class="media-object" src="{{ media.link }}" height="{{ media.height if media.height }}" alt="{{ media.alt}}"></a>
        {% endif %}
        <div class="media-body">
            <h3 class="media-heading">
                {% block view_header %}
                    {{ s.print_value(context[scaffolding.singular]) }}
                {% endblock %}
                {{ buttons.edit_delete_buttons(context[scaffolding.singular], target=scaffolding.singular) }}
            </h3>
            {% block view_detail %}{% endblock %}
        </div>
    </div>

    <table class="table table-striped table-hover table-condensed">
        <thead>
            <tr>
                {% block table_head %}
                {% endblock %}
            </tr>
        </thead>
        <tbody>
            {% if context['related'] %}
                {% block table_body %}
                {% endblock %}
            {% endif %}
        </tbody>
    </table>

    {% if context['related'] %}
        {{ s.next_page_link() }}
    {% elif context['related_name'] %}
        <div class="alert alert-info text-center">no related {{ context['related_name'] }} found</div>
    {% endif %}

{% endblock %}
